﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DTOSingTowerMall;

namespace BLSingTowerMall
{
    public class PromotionProcess
    {
        private DBSingTowerMallEntities cntx = new DBSingTowerMallEntities();

        public IQueryable<ICampaign> getPromoDetails()
        {
            IQueryable<ICampaign> promotionsList = (from f in cntx.Campaigns 
                                                    where f.Status == "Approved"
                                                    select f);
            return promotionsList;

        }

        public IQueryable<ICampaign> getPromos()
        {
            var promotionsList = from f in cntx.Campaigns
                                 where f.Status == null
                                 select f;
            return promotionsList;
        }

        public IQueryable<Campaign> getPromotsData(int campaignId)
        {
            IQueryable<Campaign> prmt = from p in cntx.Campaigns
                                        where p.CampaignID == campaignId
                                        select p;

            //var ehb = db.EventHallBookings
            //    .Where(a => a.BookingID == bookingId)
            //    .Select(a => a).ToList();
            return prmt;
        }

        public void getApproval()
        {
            //db.AddToEventHallBookings(ehb);
            cntx.SaveChanges();
        }
    }
}
